<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="/static/js/jquery.min.js"></script>
    <link href="/static/css/alert.css" rel="stylesheet">
    <link href="/static/css/css.css" rel="stylesheet">
    <style>
        h1{
            width: 100%;
            height: 60px;
            text-align: center;
        }
        .create .inputs div a{
            display: inline-block;
            text-align: center;
            background-color: #1aceee;
            color: #fff;
            height: 25px;
            line-height: 25px;
            width: 80px;
            padding:5px;
            margin: auto;
        }
        .create{
            display: none;
            position: absolute;
            top:10%;
            left:50%;
            margin-left: -202px;
            width: 400px;
            height: 230px;
            border: 2px solid #7ff77f;
            background-color: #fff;
            z-index: 1001;
        }
        .create .inputs{
            width: 95%;
            padding: 5px 2.5%;
        }
        .create .inputs div{
            width: 100%;
            height: 50px;
            text-align: center;
            line-height: 50px;
        }
    </style>
</head>
<script>
    function create(){
        block_mask_show();
        document.getElementById('create_div').style = 'display:block';
    }

    function createe(){
        block_mask_show();
        document.getElementById('order-info-message').style = 'display:block';
    }
    function create_baidukeywords(){
        let keywords = document.getElementById('keywords'),
            company_name = document.getElementById('company_name');
        let data = {
            keyword:keywords.value,
            corporate_name:company_name.value
        };
        $.ajax({
            url:'/index/keyword/baidu',
            type: 'post', // 请求类型，可以是 'GET' 或 'POST'
            data:data,
            dataType: 'json', // 预期服务器返回的数据类型
            success: function(res) {
                if(res.code == 200){
                    show_after('添加成功','创建账号',true);
                }else{
                    show_after(res.msg,'创建失败',false);
                }
            }
        });
    }
    function create_email(){
        let email = document.getElementById('email'),
            realname = document.getElementById('realname');
        let data = {
            email:email.value,
            name:realname.value
        };
        $.ajax({
            url:'/index/keyword/baidu',
            type: 'post', // 请求类型，可以是 'GET' 或 'POST'
            data:data,
            dataType: 'json', // 预期服务器返回的数据类型
            success: function(res) {
                if(res.code == 200){
                    show_after('添加成功','创建账号',true);
                }else{
                    show_after(res.msg,'创建失败',false);
                }
            }
        });
    }
</script>
<body>
    <div class="create" id="create_div">
        <div class="inputs">
            <div>
                <label for="keywords">
                    <span>关键词:</span><input type="text" id="keywords">
                </label>
            </div>
            <div>
                <label for="company_name">
                    <span>公司名称:</span><input type="text" id="company_name">
                </label>
            </div>
            <div>
                <a href="javascript:create_baidukeywords();">确定</a>
                <a href="javascript:hiddenmsg();">取消</a>
            </div>
        </div>
    </div>
    <div class="create" id="order-info-message">
        <div class="inputs">
            <div>
                <label for="keywords">
                    <span>邮箱:</span><input type="text" id="email">
                </label>
            </div>
            <div>
                <label for="company_name">
                    <span>负责人:</span><input type="text" id="realname">
                </label>
            </div>
            <div>
                <a href="javascript:create_email();">确定</a>
                <a href="javascript:hiddenmsg();">取消</a>
            </div>
        </div>
    </div>
    <div class="order-page">
        <h1>需要监控的关键词</h1>
        <table class="order-page-table">
            <thead>
                <tr>
                    <th colspan="3" style="text-align: left;text-indent: 40px;border-bottom: 1px solid #fff">
                        <a href="javascript:create();" style="color: #fff;">添加</a>
                    </th>
                </tr>
                <tr>
                    <th>公司名称</th>
                    <th>关键词</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody id="order-list">
                {volist name="list" id="value"}
                <tr>
                    <td>
                        {$value.corporate_name}
                    </td>
                    <td>
                        {$value.keyword}
                    </td>
                    <td>
                        <a href="/index/keyword/baidu?idk={$value.id}" class="button">删除</a>
                    </td>
                </tr>
                {/volist}
           </tbody>
            <tfoot>
                <tr>
                    <td colspan="8">
                        <div class="page">
                            {$list|raw}
                        </div>
                    </td>
                </tr>
            </tfoot>
        </table>
        <h1>通知的邮箱账号</h1>
        <table class="order-page-table">
            <thead>
                <tr>
                    <th colspan="3" style="text-align: left;text-indent: 40px;border-bottom: 1px solid #fff">
                        <a href="javascript:createe();" style="color: #fff;">添加</a>
                    </th>
                </tr>
                <tr>
                    <th>邮箱</th>
                    <th>负责人</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                {volist name="user" id="value"}
                <tr>
                    <td>
                        {$value.email}
                    </td>
                    <td>
                        {$value.name}
                    </td>
                    <td>
                        <a href="/index/keyword/baidu?ide={$value.id}" class="button">删除</a>
                    </td>
                </tr>
                {/volist}
            </tbody>
        </table>
    </div>
</body>
<script src="/static/js/base.js"></script>
</html>